within MediaDevel.Media;

package Interfaces "Interfaces for media models"
  extends Modelica.Icons.Library;
//  extends Icons.Basic.Library;

//  import MediaDevel.Media.Functions.*;
//  import MediaDevel.Media.Classes.*;

  partial package TemplateMedium "Template for media models"
    extends Media.Interfaces.PartialMedium(
      final mediumName =   "NameOfMedium",
//      final substanceNames={mediumName},
//      final singleState=false,
//      final reducedX =  true,
//      final fixedX = true,
      Temperature(min=273, max=450, start=323));

      // Provide medium constants here
      constant SpecificHeatCapacity cp_const = 123456
      "Constant specific heat capacity at constant pressure";

    model BaseProperties //(final standardOrderComponents=true)
      "Base properties of medium"
//      extends BaseProperties(final standardOrderComponents=true);
    equation
      d = 1;
      h = cp_const*T;
      u = h - p/d;
      MM = 0.024;
      R  = 8.3144/MM;
      state.p = p;
      state.T = T;
      annotation (Documentation(info="<html></html>"),
                  Documentation(revisions="<html>

</html>"));
    end BaseProperties;

    replaceable record ThermodynamicState
      "a selction of variables that uniquely defines the thermodynamic state"
      extends States_pT;
//      AbsolutePressure p "Absolute pressure of medium";
//      Temperature T "Temperature of medium";
      annotation (Documentation(info="<html>

</html>"));
    end ThermodynamicState;

    replaceable function dynamicViscosity "Return dynamic viscosity"
      extends _dynamicViscosity(redeclare input ThermodynamicState rec);
    algorithm
      eta := 10 - rec.T*0.3 + rec.p*0.2;
      annotation (Documentation(info="<html>

</html>"));
    end dynamicViscosity;

    annotation (Documentation(info="<HTML>
<p>
This package is a <b>template</b> for <b>new medium</b> models. For a new
medium model just make a copy of this package, remove the
\"partial\" keyword from the package and provide
the information that is requested in the comments of the
Modelica source.
</p>
</HTML>"));
  end TemplateMedium;

  partial package PartialMedium
    "Partial medium properties (base package of all media packages)"
    extends Modelica.Icons.Library;
//    extends Icons.Basic.Library;

//    import SI = Modelica.SIunits;
//    replaceable PlatformType Pf = PlatformType.OpenModelica;

    // Constants to be set in Medium
//    constant IndependentVariables ThermoStates "Enumeration type for independent variables";
    constant String mediumName = "unusablePartialMedium" "Name of the medium";

  end PartialMedium;

  annotation (Documentation(info="<HTML>
<p>
This package provides basic interfaces definitions of media models for different
kind of media.
</p>
</HTML>"));
end Interfaces;

